package com.singfan.core.component;

import com.singfan.core.dao.database.model.ShopToken;

/**
 * Author: hansonghe
 * Date: 2015-10-08 16:01
 * Desc:
 */
public class ShopTokenHolder {
    private static final ThreadLocal<ShopToken> shopTokenLocal = new ThreadLocal<ShopToken>();

    public static void bindShopToken(ShopToken shopToken){
        if(shopToken == null){
            shopTokenLocal.remove();
        }
        else{
            shopTokenLocal.set(shopToken);
        }
    }

    public static ShopToken getCurrentShopToken(){
        return shopTokenLocal.get();
    }

    public static void unbindShopToken(){
        shopTokenLocal.remove();
    }
}
